package com.ssy.lingxi.after.sale;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableAsync;

@EnableFeignClients(basePackages = {"com.ssy.lingxi.**.api"})
@EnableCaching
@ComponentScan(basePackages = {"com.ssy.lingxi"})
@EntityScan(basePackages = {"com.ssy.lingxi.after.sale.entity"})
@SpringBootApplication
@EnableAsync
public class AfterSaleServiceApplication {

    public static void main(String[] args) {
        SpringApplication.run(AfterSaleServiceApplication.class, args);
    }

    /*
    //feign远程调用丢失请求头问题
    @Bean("requestInterceptor")
    public RequestInterceptor requestInterceptor(){
        return template -> {
            ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
            HttpServletRequest request = attributes.getRequest();
            Enumeration<String> headerNames = request.getHeaderNames();
            while(headerNames.hasMoreElements()){
                String key = headerNames.nextElement();
                template.header(key, request.getHeader(key));
            }
        };
    }
     */
}
